package com.eqdd.yiqidian.ui.yiqiyue;

import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.View;

import com.eqdd.yiqidian.R;
import com.eqdd.yiqidian.YueFragmentActivityCustom;
import com.eqdd.yiqidian.base.BaseActivity;
import com.eqdd.yiqidian.base.Config;
import com.eqdd.yiqidian.http.HttpConfig;
import com.eqdd.yiqidian.ui.yiqiyue.fragment.YueFragment;

/**
 * @author吕志豪 .
 * @date 17-12-20  下午2:15.
 * Github :https://github.com/lvzhihao100
 * E-Mail：1030753080@qq.com
 * 简书 :http://www.jianshu.com/u/6e525b929aac
 */

public class YueLabelListActivity extends BaseActivity {

    private YueFragmentActivityCustom dataBinding;
    private YueFragment yueFragment;

    @Override
    public void initBinding() {
        dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_yue_fragment);
        initTopTitleBar(View.VISIBLE, "分类");
    }

    @Override
    public void initData() {
        String label = getIntent().getStringExtra(Config.LABEL);
        yueFragment = new YueFragment();
        Bundle bundle = new Bundle();
        bundle.putString(Config.URL, HttpConfig.YUE_LABEL_ARTICLE_LIST);
        bundle.putString(Config.LABEL, label);
        yueFragment.setArguments(bundle);
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.add(R.id.fragment, yueFragment);
        fragmentTransaction.commit();
    }

    @Override
    public void setView() {

    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        String label = intent.getStringExtra(Config.LABEL);
        yueFragment.changeLabel(label);
    }
}
